<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加新的影片</title>
<link href="html/css/css.css" rel="stylesheet" type="text/css" />
<script Language="JavaScript" src="html/js/functions.js"></script>
<script Language="JavaScript" src="html/js/myjs.js"></script>
<script language="javascript">

//提交验证
function check_submit()
{

		if($('Name').value =='')
		{
			msg_box('您还没有填写影片名哦!');
			$('Name').focus();
			return false;
		}

		
		if($('CategoryID').value =='-1')
		{
			msg_box('您还没有选择分类!');
			//$('categoryid').focus();
			return false;
		}

		$('count').value = allCount;
		$('submit').disabled = true;
		$('submit').src = 'html/images/ajax.gif';
		return true;
}

function checkImg()
{
	if($('img_check').checked == true)
	{
		$('img_area').innerHTML = '<input name="Photo" type="text" class="txt" id="Photo" />';
		$('img_text').style.color = '#f00';
		
	}
	else
	{
		$('img_area').innerHTML = '<input name="Photo" type="file" class="txt" id="PhotoFile" />';
		$('img_text').style.color = '#ccc';
	}
}

//添加剧集部分

function add_line(num)
{
	for(i=0;i<num;i++)
	{
		add_property_line();
	}
}

//剧集输入框

var allCount=1;

function add_property_line()
{

	newRow = property.insertRow(property.rows.length);
	newRow.id = "tdt";
	newRow.ln = allCount;
	
	c1 = newRow.insertCell(0);
	c1html = "<input name='Name_" + allCount + "' type='text' class='in' value='第"+ allCount +"集' style='width:80px;' ondblclick='changeName(this.id);' id='Name_" + allCount + "' />\n";
	c1.innerHTML = c1html;
	c1.align = 'left';
	
	c2 = newRow.insertCell(1);
	c1html = "<select name='Server_" + allCount + "'  id='server_" + allCount + "'><option value='0'>默认服务器</option><foreach name="ServerList" key="key" var="var"><option value='[$var.Sid]'>[$var.Name]</option></foreach></select>\n";
	
	
	
	c2.innerHTML = c1html;
	c2.align = 'left';
	
	c3 = newRow.insertCell(2);
	c1html = "<input name='URL_" + allCount + "' type='text' class='in' style='width:400px;'/>\n";
	c3.innerHTML = c1html;
	c3.align = 'left';
	
	c4 = newRow.insertCell(3);
	c1html = "<input name='Top_" + allCount + "' type='text' class='in' style='width:80px;'/>\n";
	c4.innerHTML = c1html;
	c4.align = 'left';
	
	//c2.id = "file_input"+ allCount;
	

	c5=newRow.insertCell(4);
	c1html = "<input type='button' name='btn' value='删除' onclick='del_property_line("+allCount+")' class='btn'>\n";
	c5.innerHTML = c1html;
	c5.align = 'left';
	
	$('Server_' + allCount).value = $('Server').value;
	
	allCount++;
}


function del_property_line(count)
{

  for (i=1;i<property.rows.length;i++)
	  {
		if (tdt[i].ln==count)
			property.deleteRow(i);
	  }
	allCount --;
}

function select_category_list(page,cid)
{
	
	msg_box('正在载入...请稍后..!');
	
	var pars = 'c=category'
	+ '&d=select'
	+ '&page=' + page
	
	var on_complete = function(req)
	{
		if($('content_msg'))
		{
			$('content_msg').innerHTML = req.responseText;
		}
		else
		{
			select_box('[ 商品选择框 ]','请至少选择一个商品作为相关商品',req.responseText,'javascript:add()');
		}
		
		listItem = new list_item_onclick('list_item');
		listItem.init();
	};
	
	var on_error = function()
	{
		msg_box('网络超时,请稍候再试!');
	}
	
	var sel=$n("select");
	for(var i=0;i<sel.length;i++){sel[i].style.visibility = "hidden"}
	
	var xmlHandle = $.Ajax.get("index.php?c=movie&d=showDate",on_complete,on_error);
	//发送请求
	//new Ajax.request('index.php',{method: 'get' , outTime : 10 , parameters: pars , onError : on_error, onComplete: on_complete});
	
}

</script>

<style type="text/css">
.btn{padding:2px; border:1px solid;margin:3px 0;*padding:4px 5px 1px; border-color:#ddd #666 #666 #ddd; background:#DDD; color:#000; cursor:pointer; }
#property .in{border:1px solid #ccc; height:20px; line-height:20px;}
</style>
</head>

<body>

<if $Msg>
<div id="msg"><img src="html/images/information.gif" width="16" height="16" align="absmiddle" />[$Msg]</div>
</if>

<form action="" method="post" enctype="multipart/form-data" name="form" id="form" style="margin:0px" onsubmit="return check_submit();">
<input type="hidden" name="SubCategoryID" id="SubCategoryID" value="" />
<input type="hidden" name="SpecialID" id="SpecialID" value="" />
<input name="count" type="hidden" class="in" id="count" />

<div class="form_box">
	<div class="header">
    <img src="html/images/television.png" width="16" height="16" align="absmiddle" />&nbsp;添加新的影片
<if $Msg>
<a href="../?c=movie&d=view&id=[$MovieInfo.Id]" target="_blank" style="color:#f00;">查看 [ [@CsubStr($MovieInfo.Name,0,25)] ] </a>
</if>
    </div>
  <div class="box">
    	<div class="text">
    	影片名:
</div>
        <div class="input">
    		<input name="Name" type="text" id="Name" />
       	</div>
        <div style="clear:both"></div>
    </div>
    <div class="box">
    	<div class="text">
    	关键字:
    	</div>
        <div class="input">
    		<input name="KeyWords" type="text" id="KeyWords" />
            <br><img src="html/images/information.gif" width="16" height="16" align="absmiddle" /> 影片关键字，用空格隔开
       	</div>
        <div style="clear:both"></div>
    </div>

<div class="box">
    	<div class="text">
    	缩略图:<span id="img_text" style="color:#ccc;">网络地址:<input name="img_check" id="img_check" type="checkbox" value="true" onclick="checkImg();" /></span>
    	</div>
        <div class="input">
    		<span id="img_area"><input name="Photo" type="file" id="PhotoFile"  /></span>
       	</div>
        <div style="clear:both"></div>
    </div>

<div class="box">
    	<div class="text">
    	类型:
        </div>
        <div class="input">
    		
           <select name="Type" id="Type">
           
               <foreach name="TypeList" key="key" var="var">
               <if $var.Default == 1>
               	<option value="[$var.Id]" selected="selected">[$var.Name]</option>
                <else>
                <option value="[$var.Id]">[$var.Name]</option>
                </if>
               </foreach>
           
           </select>
            
       	</div>
        <div style="clear:both"></div>
    </div>

<div class="box">
    	<div class="text">
    	主分类:
</div>
        <div class="input">
    	<if $CategoryForSelect>
    		<select name="CategoryID" id="CategoryID">
            <option value="-1">请选择分类</option>
            [$CategoryForSelect]
          </select>
           <else>
           <input name="CategoryID" type="hidden" value="-1"  />
          <a href="index.php?c=category&d=add"><font color="#FF0000"><strong>暂无分类，不能添加数据，点击这里添加新的分类</strong></font></a>          
          </if>  
          
          <!--
          附加分类：<input name="SubCategoryName" type="text" id="SubCategoryName" style="width:46%" onclick="getCategory();" readonly="readonly"/>
          -->
       	</div>
        <div style="clear:both"></div>
    </div>


     <div class="box">
    	<div class="text">
    	语言对白:
    	</div>
        <div class="input">

<foreach name="LanguageList" key="key" var="var">
<if $var.Default ==1>
<input name="Language" type="radio" value="[$var.Id]" class="radio" checked="checked"/> [$var.Name]
<else>
<input name="Language" type="radio" value="[$var.Id]" class="radio"/> [$var.Name]
</if>
</foreach>

       	</div>
        <div style="clear:both"></div>
    </div>

     <div class="box">
    	<div class="text">
    	影片所属地区:
    	</div>
        <div class="input">

<foreach name="AreaList" key="key" var="var">
<if $var.Default ==1>
<input name="Area" type="radio" value="[$var.Id]" class="radio" checked="checked"/> [$var.Name]
<else>
<input name="Area" type="radio" value="[$var.Id]" class="radio"/> [$var.Name]
</if>
</foreach>

       	</div>
        <div style="clear:both"></div>
    </div>


<div class="box">
    	<div class="text">
    	演员列表:
    	</div>
        <div class="input">

<textarea class="textarea" name="Actor" style="width:70%"></textarea>
<br><img src="html/images/information.gif" width="16" height="16" align="absmiddle" /> 影片演员，用空格或者逗号隔开
       	</div>
        <div style="clear:both"></div>
    </div>
    
   <div class="box">
    	<div class="text">
    	上映年份:
    	</div>
        <div class="input">
    		<input name="Year" type="text" id="Year" onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" />
            <br><img src="html/images/information.gif" width="16" height="16" align="absmiddle" /> 上映年份，如：2009
       	</div>
        <div style="clear:both"></div>
    </div>
    
   <div class="box">
    	<div class="text">
    	导演:
    	</div>
        <div class="input">
    		<input name="DireCtor" type="text" class="txt" id="DireCtor" />
       	</div>
        <div style="clear:both"></div>
    </div>

   <div class="box">
    	<div class="text">
    	连载状态:
    	</div>
        <div class="input">
<select name="PlayDate">
    <option value="1">已经完结</option>
    <option value="2">连载中</option>
    <option value="3">不定期连载</option>
</select>
       	</div>
        <div style="clear:both"></div>
    </div>


    <div class="box">
    	<div class="text">
    	影片简介:<br /><br />

删除连接：<input type="checkbox" name="Dellink" value="1" checked="checked" />

    	</div>
        <div class="input">
    		      <input type="hidden" id="Content" name="Content" style="display:none" value=""/>
                  <input type="hidden" id="Content___Config" value="" style="display:none" />                 
                   <iframe id="Content___Frame" src="editor/fck/editor/fckeditor.html?InstanceName=Content&amp;Toolbar=Default" width="80%" height="250" frameborder="no" scrolling="no"></iframe>
       	</div>
        <div style="clear:both"></div>
    </div>

      <div class="box">
    	<div class="text">
    	是否为高清电影:
    	</div>
        <div class="input">
    		<input name="IsHD" type="radio" value="1" class="radio" checked="checked"/> 是 <input name="IsHD" type="radio" value="-1" class="radio"/> 不是
       	</div>
        <div style="clear:both"></div>
    </div>

      <div class="box">
    	<div class="text">
    	是否为新片:
    	</div>
        <div class="input">
    		<input name="IsNew" type="radio" value="1" class="radio" /> 是 <input name="IsNew" type="radio" value="-1" class="radio" checked="checked"/> 不是
       	</div>
        <div style="clear:both"></div>
    </div>
    

    <div class="box">
    	<div class="text">
    	审核状态:
    	</div>
        <div class="input">
    		<select name="State">
            <option value="1" selected="selected">已审核</option>
            <option value="-1">未审核</option>
            </select>
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	首页推荐:
    	</div>
        <div class="input">
    		<select name="IsIndex">
            <option value="1">是</option>
            <option value="-1" selected="selected">否</option>
            </select>
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	套红推荐:
    	</div>
        <div class="input">
    		<select name="IsRed">
            <option value="1">是</option>
            <option value="-1" selected="selected">否</option>
            </select>
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	关闭评论:
    	</div>
        <div class="input">
    		<select name="IsComment">
            <option value="-1">是</option>
            <option value="1" selected="selected">否</option>
            </select>
       	</div>
        <div style="clear:both"></div>
    </div>
    

    <div class="box">
   	  <div class="text">
    	自定义标识:
    	</div>
        <div class="input">
    		<input name="Mark" type="text" id="Mark"/>
            <br><img src="html/images/information.gif" width="16" height="16" align="absmiddle" /> 用于扩展调用
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	排序:
    	</div>
        <div class="input">
    		<input name="Top" type="text" id="Top"  />
            <br><img src="html/images/information.gif" width="16" height="16" align="absmiddle" /> 数字越大越靠前
       	</div>
        <div style="clear:both"></div>
    </div>
    
    
    <div class="box">
    	<div class="text">
    	点击数:
    	</div>
        <div class="input">
    		<input name="Hits" type="text" id="Hits"  />
       	</div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	附加分类:
    	</div>
        <div class="input">
   		<a href="javascript:select_category_list(1,1)">请选择该影片的附加分类</a>    
        <br /> <img src="html/images/information.gif" width="16" height="16" align="absmiddle" />  把该影片分配给其他相关分类  	
        </div>
        <div style="clear:both"></div>
    </div>
    
    <div class="box">
    	<div class="text">
    	所属专辑:
    	</div>
        <div class="input">
   		<a href="javascript:select_category_list(1,1)">点击这里选择该影片所属的专辑</a>    
        <br /> <img src="html/images/information.gif" width="16" height="16" align="absmiddle" />  把该影片分配给不同的专辑  	
        </div>
        <div style="clear:both"></div>
    </div>
    
<div class="URL_LIST" style="padding-left:10px;">
<table width="750" class="opt">
                  <tr>
                    <th colspan="3">增加数目:</th>
                  </tr>
                  <tr>
                    <td width="112"><input name="num" type="text" id="num" class="txt" style="width:50px;" value="1" />条</td>
                    <td width="112"><label>
                      <select name="select" id="server">
                        <option value="0">默认服务器</option>
                        <foreach name="ServerList" key="key" var="var"><option value='[$var.Sid]'>[$var.Name]</option></foreach>
                      </select>
                    </label></td>
                    <td width="626" align="left"><input type="button" value="增加" class="btn" onclick="add_line($('num').value)"  style="height:28px;"/>&nbsp;<input type="button" value="1条" class="btn" onclick="add_line(1)"/>&nbsp;<input type="button" value="2条" class="btn" onclick="add_line(2)"/>&nbsp;<input type="button" value="3条" class="btn" onclick="add_line(3)"/>                    </td>
                  </tr>
                  <tr>
                    <th colspan="3">点播列表（点击上面的按钮显示输入框）:</th>
                  </tr>
                  <tr>
                    <td colspan="3">
            <table border="0" cellspacing="0" id="property">
         	<tr id=tdt>
            <td nowrap="nowrap" style="width:90px;">名称</td>
            <td nowrap="nowrap" style="width:100px;">服务器</td>
            <td nowrap="nowrap" style="width:410px;">地址</td>
            <td nowrap="nowrap" style="width:100px;">排序</td>
            <td nowrap="nowrap" style="width:90px;">删除</td>
          </tr>
		  </table>                   
           </td>
                  </tr>

                  <tbody>
                  </tbody>
                </table>
</div>
    </div>
</div>
<div class="form_box_bottom">
<input type="image" src="html/images/submit.gif" align="absmiddle" border="0" title="保存" id="submit" /></a>
<a href="javascript:history.go(-1);"><img src="html/images/msg_cancel.gif" align="absmiddle" border="0" title="返回上一页" /></a>
</div>
</form>
</body>
</html>
